STEP 1: The code that creates this drawing is inefficient. We wrote the exact same commands NINE times!

  • Which commands are repeated? Let's place a comment before and after those commands first appear.
  • Place a #comment on the line above the beginning of the first section of code that is used more than once.
  • Place a #comment on the line below the end of the first section of code that is used more than once.

One way to make code more efficient is to place repeated commands in a loop. We'll do that next!

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)